home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 35 / Amiga Format AFCD35 (Issue 119, Jan 1999).iso / -in_the_mag- / reader_requests / fredobbutils / bbsrc / bootenv.s < prev    next >
Text File  |  1998-11-06  |  4KB  |  204 lines

  1. ************* Bootblock spécial *****************
  2. * - affiche un gfx au format RAW (cf.GFXCONV)    *
  3. * - attend un clic de souris            *
  4. **************** Par Frédo!! ********************
  5.  
  6. * Another bootblock example:
  7. * draw a little raw graphic
  8.  
  9.     incdir    asm:/Include/
  10.     include    equ.s
  11.     include    exec/types.i
  12.     include    graphics/text.i
  13.     include    graphics/gfx.i
  14.     include    graphics/rastport.i
  15.  
  16.     rsreset
  17. planes    rs.l    1
  18. gfxbase    rs.l    1
  19. olddma    rs.w    1
  20. scrw    rs.w    1
  21. scrh    rs.w    1
  22. rast    rs.b    rp_SIZEOF
  23. bmap    rs.b    bm_SIZEOF
  24. VARSIZE    rs.w    0
  25.  
  26. WIDTH=320*1
  27. HEIGHT=256
  28. DEPTH=1
  29. BYTESPERROW=WIDTH/8
  30. PLSIZE=(BYTESPERROW)*HEIGHT
  31. PLANESIZE=PLSIZE*DEPTH
  32.  
  33. COL0=$000
  34. COL1=$f00
  35.  
  36. ;coordonnées dessin
  37. X=100
  38. Y=100
  39.  
  40. ;DBUG=0
  41.  
  42. Start:
  43.     IFND    DBUG
  44.     dc.b    "DOS",1
  45.     dc.l    0,$370
  46.     ENDC
  47. Main:
  48.     movem.l    d0-a6,-(sp)
  49.     lea    -VARSIZE(sp),sp    ;on utilise la pile comme base des variables
  50.     move.l    sp,a5        ;VarBase en a5
  51.  
  52.     IFD    DBUG
  53.     move.l    4.w,a6
  54.     ENDC
  55.     move.l    $9c(a6),gfxbase(a5)
  56. * Allouer buffer pour les bitplanes & copperlist
  57.     move.l    #BUFSIZE,d0
  58.     move.l    #$10002,d1
  59.     jsr    AllocMem(a6)
  60.     move.l    d0,planes(a5)
  61.     beq.w    fin
  62.     move.l    d0,d4
  63.  
  64.     lea    rast(a5),a1
  65.     move.l    a1,-(sp)
  66.     move.l    gfxbase(a5),a6
  67.     jsr    InitRastPort(a6)
  68.  
  69.     lea    bmap(a5),a0
  70.     move.l    a0,-(sp)
  71. * adresse des bitplanes
  72. ;    lea    bm_Planes(a0),a0
  73.     addq.l    #8,a0
  74.     moveq    #DEPTH-1,d0
  75. .pl    move.l    d4,(a0)+
  76.     add    #PLSIZE,d4
  77.     dbf    d0,.pl
  78.     move.l    (sp)+,a0
  79.     move.l    (sp)+,a1
  80.     move.l    a0,rp_BitMap(a1)
  81.     moveq    #DEPTH,d0
  82.     move    #WIDTH,d1
  83.     move    #HEIGHT,d2
  84.     movem    d1-d2,scrw(a5)
  85.     jsr    InitBitMap(a6)
  86. * copier les données RAW vers bitplane
  87.     lea    rawdata(pc),a0
  88.     move.l    planes(a5),a2    ;adr bitplane
  89.     add    #(Y*BYTESPERROW)+(X/8),a2
  90.     moveq    #6-1,d7    ;nbre de lignes
  91. .cop0
  92.     move.l    a2,a1
  93.     moveq    #(RAWSIZE/6)-1,d0    ;octets/ligne = RAWSIZE/#lignes
  94. .cop    move.b    (a0)+,(a1)+
  95.     dbf    d0,.cop
  96.     lea    BYTESPERROW(a2),a2    ;ligne suivante
  97.     dbf    d7,.cop0
  98.  
  99.     lea    $dff000,a4
  100.     move    $02(a4),olddma(a5)
  101.     or    #$8000,olddma(a5)
  102.     move    #$7fff,$96(a4)    ;dma off
  103.     lea    coplist(pc),a1
  104. * adresse des bitplanes
  105.     move.l    planes(a5),d0
  106.     move.l    d0,a2
  107.     move    d0,lo1-coplist(a1)
  108.     swap    d0
  109.     move    d0,hi1-coplist(a1)
  110. * copier copperlist ds buffer
  111.     lea    PLSIZE(a2),a2
  112.     move.l    a2,a3
  113.     moveq    #(COPSIZE/4)-1,d0
  114. .copy
  115.     move.l    (a1)+,(a2)+
  116.     dbf    d0,.copy
  117.  
  118.     move.l    a3,$80(a4)
  119.     clr    $88(a4)
  120.     move    #%1000011111000000,$96(a4)    ;mon dma
  121.  
  122. .w    btst    #6,$bfe001
  123.     bne.s    .w
  124. CloseAll
  125.     move.l    planes(a5),a1
  126.     move.l    #BUFSIZE,d0
  127.     move.l    4.w,a6
  128.     jsr    FreeMem(a6)
  129. restore
  130.     move.l    $9c(a6),a0
  131.     move.l    38(a0),$80(a4)
  132.     clr    $88(a4)
  133.     move    olddma(a5),$96(a4)
  134. fin
  135.     lea    VARSIZE(sp),sp    ;restitue la pile
  136.     movem.l    (sp)+,d0-a6
  137.  
  138. Init:
  139.     IFND    DBUG
  140.     lea    expansion.name(pc),a1
  141.     moveq    #37,d0
  142.     jsr    -552(a6)
  143.     tst.l    d0
  144.     beq.b    .err
  145.     move.l    d0,a1
  146.     bset    #6,34(a1)
  147.     jsr    -414(a6)
  148. .err    lea    dos.name(pc),a1
  149.     jsr    -96(a6)
  150.     tst.l    d0
  151.     beq.b    .nodos
  152.     move.l    d0,a0
  153.     move.l    22(a0),a0
  154.     moveq    #0,d0
  155.     rts
  156. .nodos    moveq    #-1,d0
  157.     ENDC
  158.     rts
  159.  
  160. *** DATA
  161. LORES=(DEPTH<<12)!$200
  162. HIRES=LORES!$8000
  163. LACE=4
  164.  
  165. RES=LORES
  166.  
  167. coplist:
  168.  DC.w $0100,RES
  169.  dc.w $0108,$0000
  170.  dc.w $008E,$2981
  171.  DC.w $0090,$29c1
  172.  IF RES=LORES
  173.  dc.w $0092,$0038
  174.  DC.w $0094,$00D0
  175.  ELSE
  176.  dc.w $0092,$003c
  177.  dc.w $0094,$00d4
  178.  ENDC
  179.  DC.w $0180,COL0
  180.  dc.w $0182,COL1
  181.  dc.w $00e0
  182. hi1:dc.w 0
  183.  dc.w $00e2
  184. lo1:dc.w 0
  185.  dc.w $FFFF,$FFFE    ;fin de la liste copper
  186. COPSIZE=*-coplist
  187. BUFSIZE=PLANESIZE+COPSIZE
  188.  
  189. dos.name    dc.b    'dos.library',0
  190. expansion.name    dc.b    'expansion.library',0
  191.  
  192. * RAW gfx data
  193. rawdata:
  194.  dc.b %01111111,%01111100,%01111110,%11111100,%01111110,%00011000
  195.  dc.b %11000000,%11000010,%11000000,%11000010,%11000011,%00111100
  196.  dc.b %11000000,%11000010,%11000000,%11000010,%11000011,%00111100
  197.  dc.b %11111100,%11111100,%11111100,%11000010,%11000011,%00011000
  198.  dc.b %11000000,%11000010,%11000000,%11000010,%11000011,%00000000
  199.  dc.b %11000000,%11000010,%01111110,%11111100,%01111110,%00011000
  200. RAWSIZE=*-rawdata
  201.  
  202. End:
  203.     dcb.b    512*2,0
  204.